﻿<?xml version="1.0" encoding="utf-8"?>
<Mapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Entity type="NUnit:Mapping:Interfaces:Zoo" table="Zoo">
    <Id field="Id">
      <Generator name="guid" />
    </Id>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:Dog">
      <Rule parentField="Id" childTable="Dog" childField="FK_Zoo" />
    </Reference>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:Human">
      <Rule parentField="Id" childTable="Human" childField="FK_Zoo" />
    </Reference>
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:Dog" table="Dog">
    <Id field="Id">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="Kind" field="Kind" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Reference name="Toys" entityChild="NUnit:Mapping:Interfaces:Toy">
      <Rule parentField="Id" childTable="Toy" childField="FK_Owner" />
    </Reference>
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:Human" table="Human" >
    <Id field="Id">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Attribute name="LastName" field="LastName" db-type="String" size="50" scale="0" precision="0" not-null="false" />
    <Reference name="Toys" entityChild="NUnit:Mapping:Interfaces:Toy">
      <Rule parentField="Id" childTable="Toy" childField="FK_Owner" />
    </Reference>
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:Toy" table="Toy" >
    <Id field="Id">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" field="Name" db-type="String" size="50" scale="0" precision="0" not-null="false" />
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:OneMoreItem" table="OneMoreItem">
    <Id field="StorageItemId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" table="OneMoreItem" field="Name" db-type="String" size="255" scale="0" precision="0" not-null="false" />
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:StorageItem" table="StorageItem" discriminator-field="Type" discriminator-value="NUnit:Mapping:Interfaces:StorageItem">
    <Id field="StorageItemId">
      <Generator name="guid" />
    </Id>
    <Attribute name="Name" table="StorageItem" field="Name" db-type="String" size="255" scale="0" precision="0" not-null="false" />
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:Directory" table="StorageItem" discriminator-field="Type" discriminator-value="NUnit:Mapping:Interfaces:Directory">
    <Id field="StorageItemId">
      <Generator name="guid" />
    </Id>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:StorageItem">
      <Rule parentField="StorageItemId" childTable="StorageItem" childField="FK_ParentID" />
    </Reference>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:OneMoreItem">
      <Rule parentField="StorageItemId" childTable="OneMoreItem" childField="FK_ParentID" />
    </Reference>
  </Entity>
  <Entity type="NUnit:Mapping:Interfaces:DirectoryOverride" table="StorageItem" discriminator-field="Type" discriminator-value="NUnit:Mapping:Interfaces:DirectoryOverride">
    <Id field="StorageItemId">
      <Generator name="guid" />
    </Id>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:StorageItem">
      <Rule parentField="StorageItemId" childTable="StorageItem" childField="FK_ParentID" />
    </Reference>
    <Reference name="Items" entityChild="NUnit:Mapping:Interfaces:OneMoreItem">
      <Rule parentField="StorageItemId" childTable="OneMoreItem" childField="FK_ParentID" />
    </Reference>
  </Entity>  
</Mapping>